package com.ele.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ele.pojo.Foodtype;
import com.ele.pojo.ResponseData;
import com.ele.service.FoodtypeService;
import com.ele.mapper.FoodtypeMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 28444
* @description 针对表【foodtype】的数据库操作Service实现
* @createDate 2024-04-09 08:47:58
*/
@Service
public class FoodtypeServiceImpl extends ServiceImpl<FoodtypeMapper, Foodtype>
    implements FoodtypeService{

    @Override
    public ResponseData<Foodtype> getFoodType(String businessId) {
        ResponseData<Foodtype> responseData = new ResponseData<>();
        QueryWrapper<Foodtype> wrapper = new QueryWrapper<>();
        wrapper.eq("business_id",businessId);
        List<Foodtype> list = this.list(wrapper);
        if (list != null && list.size() > 0){
            responseData.setCode(20000);
            responseData.setDatas(list);
        }else{
            responseData.setCode(50000);
            responseData.setMessage("没有查询到菜品分类数据");
        }
        return responseData;
    }
}